Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrTonCongNo_KhachHang
    Private thang, nam As String
    Private customerReport As ReportDocument
    Dim sqlQuery As String
    '   (thanhtien_dauky <> 0 OR phatsinhno_trongky <> 0 OR thanhtoan_trongky <> 0 OR thanhtien_cuoiky <> 0)

    Private Sub FrmCrTonCongNo_KhachHang_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        sqlQuery = "SELECT t1.*,t2.ten_nhacungcap as ten_khachhang  FROM tbl_dot_toncongno_khachhang as t1 left join tbl_khachhang  "
        sqlQuery += "as t2 on t1.ma_khachhang=t2.ma_nhacungcap Where  recycleID='" & nam & thang & "'  "
        sqlQuery += "AND (thanhtien_dauky <> 0 OR phatsinhno_trongky <> 0 OR thanhtoan_trongky <> 0 OR thanhtien_cuoiky <> 0)  "
        sqlQuery += "ORDER BY t2.ten_nhacungcap "
        Dim reportPath = Application.StartupPath & "\" & "CrTonCongNoKhachHang.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TThang", thang)
        customerReport.SetParameterValue("TNam", nam)
        Me.CrNXTTongHopview.ReportSource = customerReport
    End Sub

    Public Sub setThang(ByVal s As String)
        thang = s
    End Sub

    Public Sub setNam(ByVal s As String)
        nam = s
    End Sub

End Class
